package com.huo.thread.synchronizeddemo;

public class Sequence {

    private  int value;

    private  int getNext(){
        return  value ++;
    }

    public static void main(String[] args) {
        Sequence s = new Sequence();
            for(int i = 0 ; i < 3 ; i++){


            new Thread(new Runnable() {
                @Override
                public void run() {
                    while (true) {
                        System.out.println(Thread.currentThread().getName() + ":" + s.getNext());
                        try {
                            Thread.sleep(10);
                        } catch (InterruptedException e) {
                            e.printStackTrace();
                        }
                    }
                }
            }).start();
            }

    }
}
